disallow trailing letters when parsing decimal integer #204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In internal support ticket APMS-6017, a customer has an old (Java) tracer that's producing
trace_id
s that are hexadecimal strings.When the C++ tracer is parsing a
trace_id
from a header, it accepts any string that begins with decimal digits (possibly with leading whitespace), i.e. any string matching\s*[+]?(0|[1-9][0-9]+)([^0-9].*)?
. This is due to the use of std::stoull.In this pull request, I modify the parsing code to further require that the parsed decimal integer is followed by whitespace only. This way, decimal prefixes of hexadecimal
trace_id
s will fail to parse, rather than successfully parsing the decimal prefix.These changes might break things. Let's discuss if/how to roll this out.